<template>
  {{ state.number.toFixed(0) }}
</template>

<script setup lang="ts">
//数字滚动插件
import { reactive } from 'vue';
import gsap from 'gsap';
const props = defineProps({
  number: {
    type: Number,
    default: 0
  }
});
//初始化数据
const state = reactive({
  number: 0
});

const start = () => {
  gsap.to(state, {
    number: props.number,
    duration: 0.6,
    onUpdate: () => {
      console.log(state.number);
    }
  });
};

start();
</script>

<style scoped></style>
